Skip to content

Conversation

@sbernauer
Copy link
Member

@sbernauer sbernauer commented Nov 11, 2025

Description

Part of stackabletech/issues#712
Decision: https://github.com/stackabletech/decisions/issues/64
Needs stackabletech/documentation#807 for the documentation part

The actual code change is oversee-able, most of the added lines are tests.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added

@sbernauer sbernauer marked this pull request as ready for review November 20, 2025 15:24
@sbernauer sbernauer self-assigned this Nov 20, 2025
@sbernauer sbernauer moved this to Development: Waiting for Review in Stackable Engineering Nov 20, 2025
@sbernauer sbernauer requested a review from a team November 20, 2025 15:24
@Techassi Techassi self-requested a review November 20, 2025 15:30
Copy link
Member

@Techassi Techassi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly lgtm, a few various question, comments and suggestions.

Comment on lines 7 to 9
### Added

- Support `objectOverrides` ([#1118]).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I think we should add a small explanation how this works/what this does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a bit of content in 9f5019b

Comment on lines 16 to 18
### Removed

- BREAKING: `ClusterResources` no longer derives `Eq` and `PartialEq` ([#1118]).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Whats the reason those two trait implementations are removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because Vec is now stored in the ClusterResources, and DynamicObject does not implement Eq. I was at least able to derive PartialEq again: bf1d753

Comment on lines 24 to 38
merge_strategies::map::granular(
&mut self.extra_pod_selector_labels,
other.extra_pod_selector_labels,
|current_item, other_item| {
DeepMerge::merge_from(current_item, other_item);
},
);
merge_strategies::list::map(
&mut self.ports,
other.ports,
&[|lhs, rhs| lhs.name == rhs.name],
|current_item, other_item| {
DeepMerge::merge_from(current_item, other_item);
},
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Please add two dev comments to quickly explain what this code does and why we need this specialized merge.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggle to find anything that is not already on the trait docs in https://docs.rs/k8s-openapi/latest/k8s_openapi/trait.DeepMerge.html
What are you thinking of?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was able to add two comments in e28d64e

Comment on lines 49 to 63
merge_strategies::list::map(
&mut self.ingress_addresses,
other.ingress_addresses,
&[|lhs, rhs| lhs.address == rhs.address],
|current_item, other_item| {
DeepMerge::merge_from(current_item, other_item);
},
);
merge_strategies::map::granular(
&mut self.node_ports,
other.node_ports,
|current_item, other_item| {
DeepMerge::merge_from(current_item, other_item);
},
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Same as above.

let Some(patch_type) = &patch.types else {
return Ok(());
};
if patch_type.api_version != R::api_version(&()) || patch_type.kind != R::kind(&()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if patch_type.api_version != R::api_version(&()) || patch_type.kind != R::kind(&()) {
if object_type.api_version != R::api_version(&()) || object_type.kind != R::kind(&()) {

if patch_type.api_version != R::api_version(&()) || patch_type.kind != R::kind(&()) {
return Ok(());
}
let Some(patch_name) = &patch.metadata.name else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let Some(patch_name) = &patch.metadata.name else {
let Some(object_name) = &override.metadata.name else {


let deserialized_patch =
patch
.clone()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: If we need to clone every single override anyway, we should instead take an owned value (in both functions). Taking a reference is signaling that no owned data is needed, which is not true. We should make this clear when these functions are called.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to owned in 4873ac2


/// Using [`serde_yaml`] to generate the test data
fn generate_service_account() -> ServiceAccount {
serde_yaml::from_str(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Again, I would like to see this (and all other inline YAML strings) getting moved into actual YAML files.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally prefer having them in-line as this way it's IMHO much easier to read and maintain compared to cluttered over 20 files.
I was thinking of using https://docs.rs/indoc/2.0.7/indoc/, but figured it's not worth the effort, but happy to do so

Comment on lines +118 to +119
/// Generate the test data programmatically (as operators would normally do)
fn generate_stateful_set() -> StatefulSet {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: But, do we need to? I feel like this can also be a static YAML file (to actually only test the merging/overrides).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, we don't. I only did this to increase the test diversity 😅
My though process was maybe somethings with defaults with and without serde might be different and stuff.
It's not super important, but I also don't think this will hurt us in any way, so I would say better safe than sorry.

@Techassi Techassi moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Nov 23, 2025
@sbernauer sbernauer requested a review from Techassi November 23, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: In Review

Development

Successfully merging this pull request may close these issues.

3 participants